<!---
Copyright: (c) 2006 The MachBlog Authors
Authors: Matt Woodward (mpwoodward@gmail.com) & Peter J. Farrell (pjf@maestropublishing.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

$Id: Comment.cfc 1193 2007-07-18 04:41:39Z pfarrell $
--->
<cfcomponent
	displayname="Comment"
	output="false"
	hint="Comment bean for MachBlog">
	
	<!---
	PROPERTIES
	--->
	<cfproperty name="commentId" type="string" required="false" default="" />
	<cfproperty name="entryId" type="string" required="false" default="" />
	<cfproperty name="name" type="string" required="false" default="" />
	<cfproperty name="email" type="string" required="false" default="" />
	<cfproperty name="url" type="string" required="false" default="" />
	<cfproperty name="comment" type="string" required="false" default="" />
	<cfproperty name="isSubscribed" type="boolean" required="false" default="false" />
	<cfproperty name="subscriptionOnly" type="boolean" required="false" default="false" />
	<cfproperty name="subscriberEmailSent" type="boolean" required="false" default="false" />
	<cfproperty name="audit" type="machblog.org.machblog.audit.Audit" required="false" 
			default="CreateObject('component', 'machblog.org.machblog.audit.Audit').init()" />
	
	<cfset variables.instance = StructNew() />
	
	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" output="false" returntype="Comment" 
		hint="Constructor for this CFC">
		<cfargument name="commentId" type="string" required="false" default="" />
		<cfargument name="entryId" type="string" required="false" default="" />
		<cfargument name="name" type="string" required="false" default="" />
		<cfargument name="email" type="string" required="false" default="" />
		<cfargument name="url" type="string" required="false" default="" />
		<cfargument name="comment" type="string" required="false" default="" />
		<cfargument name="isSubscribed" type="boolean" required="false" default="false" />
		<cfargument name="subscriptionOnly" type="boolean" required="false" default="false" />
		<cfargument name="subscriberEmailSent" type="boolean" required="false" default="false" />
		<cfargument name="audit" type="machblog.org.machblog.audit.Audit" required="false" 
				default="#CreateObject('component', 'machblog.org.machblog.audit.Audit').init()#" />
		
		<cfset setCommentId(arguments.commentId) />
		<cfset setEntryId(arguments.entryId) />
		<cfset setName(arguments.name) />
		<cfset setEmail(arguments.email) />
		<cfset setUrl(arguments.url) />
		<cfset setComment(arguments.comment) />
		<cfset setIsSubscribed(arguments.isSubscribed) />
		<cfset setSubscriptionOnly(arguments.subscriptionOnly) />
		<cfset setSubscriberEmailSent(arguments.subscriberEmailSent) />
		<cfset setAudit(arguments.audit) />
		
		<cfreturn this />
	</cffunction>
	
	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="setMemento" access="public" returntype="User" output="false">
		<cfargument name="memento" type="struct" required="true" />
		<cfset variables.instance = arguments.memento />
		<cfreturn this />
	</cffunction>
	<cffunction name="getMemento" access="public"returntype="struct" output="false">
		<cfreturn variables.instance />
	</cffunction>

	<!---
	ACCESSORS
	--->	
	<cffunction name="setCommentId" access="public" output="false" returntype="void">
		<cfargument name="commentId" type="string" required="true" />
		<cfset variables.instance.commentId = arguments.commentId />
	</cffunction>
	<cffunction name="getCommentId" access="public" output="false" returntype="string">
		<cfreturn variables.instance.commentId />
	</cffunction>
	
	<cffunction name="setEntryId" access="public" output="false" returntype="void">
		<cfargument name="entryId" type="string" required="true" />
		<cfset variables.instance.entryId = arguments.entryId />
	</cffunction>
	<cffunction name="getEntryId" access="public" output="false" returntype="string">
		<cfreturn variables.instance.entryId />
	</cffunction>
	
	<cffunction name="setName" access="public" output="false" returntype="void">
		<cfargument name="name" type="string" required="true" />
		<cfset variables.instance.name = arguments.name />
	</cffunction>
	<cffunction name="getName" access="public" output="false" returntype="string">
		<cfreturn variables.instance.name />
	</cffunction>
	
	<cffunction name="setEmail" access="public" output="false" returntype="void">
		<cfargument name="email" type="string" required="true" />
		<cfset variables.instance.email = arguments.email />
	</cffunction>
	<cffunction name="getEmail" access="public" output="false" returntype="string">
		<cfreturn variables.instance.email />
	</cffunction>
	
	<cffunction name="setUrl" access="public" output="false" returntype="void">
		<cfargument name="url" type="string" required="true" />
		<cfset variables.instance.url = arguments.url />
	</cffunction>
	<cffunction name="getUrl" access="public" output="false" returntype="string">
		<cfreturn variables.instance.url />
	</cffunction>
	
	<cffunction name="setComment" access="public" output="false" returntype="void">
		<cfargument name="comment" type="string" required="true" />
		<cfset variables.instance.comment = arguments.comment />
	</cffunction>
	<cffunction name="getComment" access="public" output="false" returntype="string">
		<cfreturn variables.instance.comment />
	</cffunction>
	
	<cffunction name="setIsSubscribed" access="public" output="false" returntype="void">
		<cfargument name="isSubscribed" type="boolean" required="true" />
		<cfset variables.instance.isSubscribed = arguments.isSubscribed />
	</cffunction>
	<cffunction name="getIsSubscribed" access="public" output="false" returntype="boolean">
		<cfreturn variables.instance.isSubscribed />
	</cffunction>

	<cffunction name="setSubscriptionOnly" access="public" output="false" returntype="void">
		<cfargument name="subscriptionOnly" type="boolean" required="true" />
		<cfset variables.instance.subscriptionOnly = arguments.subscriptionOnly />
	</cffunction>
	<cffunction name="getSubscriptionOnly" access="public" output="false" returntype="boolean">
		<cfreturn variables.instance.subscriptionOnly />
	</cffunction>

	<cffunction name="setSubscriberEmailSent" access="public" output="false" returntype="void">
		<cfargument name="subscriberEmailSent" type="boolean" required="true" />
		<cfset variables.instance.subscriberEmailSent = arguments.subscriberEmailSent />
	</cffunction>
	<cffunction name="getSubscriberEmailSent" access="public" output="false" returntype="boolean">
		<cfreturn variables.instance.subscriberEmailSent />
	</cffunction>
	
	<cffunction name="setAudit" access="public" output="false" returntype="void">
		<cfargument name="audit" type="machblog.org.machblog.audit.Audit" required="true" />
		<cfset variables.instance.audit = arguments.audit />
	</cffunction>
	<cffunction name="getAudit" access="public" output="false" returntype="machblog.org.machblog.audit.Audit">
		<cfreturn variables.instance.audit />
	</cffunction>

</cfcomponent>